<?php
require_once 'Searcher.php';
if (isset($_REQUEST['short']) && isset($_REQUEST['q'])) {
	$res = Searcher::getInstance()->search($_REQUEST['q']);
	if ($res == NULL) {
		echo "No results found.";
	} else {
		echo $res;
	}
	die();
}
//header("Content-type: application/xhtml+xml");
echo '<?xml version="1.0" encoding="UTF-8"?>';
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">

<head>
<title>Poppy Search</title>
<meta name="Author" content="Kosutan Lehel" />
<meta name="Description" content="Search engine that combines multiple search engines." />
<meta name="keywords" content="search, search engine, links, results" />

<base href="http://poppysearch.net/" />
<link rel="start" type="text/html" href="index.php" />
<link rel="shortcut icon" href="/favicon.jpg" />
<link href="styles/default.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="scripts.js"></script>
<?php
if (isset($_REQUEST['t'])) {
	echo '<script type="text/javascript">';
	echo 'var tag = "'.$_REQUEST['t'].'";';
	echo '</script>';
}
?>
</head>

<body>

<div id="categories">Categories:<br /><?=Searcher::getInstance()->getCategories();?></div>

<div id="main">
<div id="search"><img src="logo.png" /><br />
<form onsubmit="doSearch();return false;" action="" method="get">
<input type="text" id="searchbox" size="60" onchange="preSearch();" /> <input type="submit"
    value="Search" onmouseup="doSearch();" />
    </form></div>
<div id="engines"><?=Searcher::getInstance()->printSelectedEngines();?></div>
<div id="results"><?=Searcher::getInstance()->search(isset($_REQUEST['q'])?$_REQUEST['q']:"");?></div>
</div>

<div class="clear"></div>
</body>
</html>
